﻿package com.schimanek.navigation.tree 
{
	
	/**
	 * ...
	 * @author Gregor Schimanek
	 */
	public class ATreeNode 
	{
		public var id			:String;
		public var aChildren	:Array;
		public var nextNode		:ATreeNode;
		public var prevNode		:ATreeNode;
		private var _parentNode	:ATreeNode;
		
		
		public function ATreeNode(id:String) 
		{
			this.id = id;
		}
		
		public function addChildNode(cn:ATreeNode):void {
			if(aChildren==null){
				aChildren = new Array();
			}
			cn.parentNode = this;
			aChildren.push(cn);
		}
		
		public function addNextNode(nn:ATreeNode):void {
			nextNode = nn;
			nn.prevNode = this;
			if (_parentNode != null) {
				nn.parentNode = _parentNode;
			}
		}	
		
		public function set parentNode(value:ATreeNode):void 
		{
			_parentNode = value;
			if (_parentNode.aChildren == null) {
				_parentNode.aChildren = new Array();
			}
			_parentNode.aChildren.push(this);
		}
	}
	
}